<template>
  <BasicTable @register="registerTable">
  </BasicTable>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { list } from '/@/api/business/contract';
import { columns, searchFormSchema } from './projectdata';

export default defineComponent({
  name: 'ProjectList',
  components: { BasicTable, TableAction, },
  setup() {

    const [registerTable, { reload }] = useTable({
      title: '项目清单',
      api: list,
      columns,
      formConfig: {
        labelWidth: 120,
        schemas: searchFormSchema,
        showResetButton: true,
        showAdvancedButton: true,
        autoSubmitOnEnter: true,
      },
      pagination: true,
      useSearchForm: true,
      bordered: true,
      showIndexColumn: true,
    });

    function doSearch() {
      reload();
    }

    function handleSuccess() {
      setTimeout(() => {
        reload();
      }, 200);
    }

    return {
      registerTable, handleSuccess, doSearch,
    };
  },
});
</script>
